package com.example.postgresql.controller;

import com.alibaba.fastjson.JSON;
import com.example.postgresql.entity.Message;
import com.example.postgresql.entity.Msm;
import com.example.postgresql.service.MessageService;
import com.example.postgresql.service.MsmService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 * (Message)表控制层
 *
 * @author makejava
 * @since 2021-09-27 14:35:31
 */
@RestController
@RequestMapping("msm")
public class MsmController {
    /**
     * 服务对象
     */
    @Resource
    private MsmService msmService;



    @PostMapping("queryAllMessage")
    public Map<String, Object> queryAll(Msm msm) {
        return this.msmService.queryAll(msm);
    }

    @PostMapping(value = "sendMessage")
    public Map<String,Object> sendMessage(@RequestBody String params) {
        Msm msm = JSON.parseObject(params,Msm.class);
        return this.msmService.insert(msm);
    }

}
